//
//  ICMRepairPartsCell.m
//  ICrEAM
//
//  Created by xphone on 16/11/24.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ICMRepairPartsCell.h"

@interface ICMRepairPartsCell ()

@property (nonatomic,copy) UILabel *nameLabel;

@property (nonatomic,copy) UILabel *codeLabel;

@property (nonatomic,copy) UILabel *attribiteLabel;

@property (nonatomic,copy) UILabel *storePostionLabel;

@property (nonatomic,copy) UILabel *stockQuantityLabel;

@property (nonatomic,copy) UILabel *realQuantityLabel;

@property (nonatomic,copy) UILabel *sellPriceLabel;

@end

@implementation ICMRepairPartsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (UILabel *)nameLabel{
    if(!_nameLabel){
        
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, ActualHeight(10), ActualWidth(224), ActualHeight(34))];
        
        _nameLabel.textColor = ContentTextColor_Black;
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        _nameLabel.font = NaviFont;
        
        [self addSubview:_nameLabel];
        
        
        
    }
    return _nameLabel;
    
}
- (UILabel *)codeLabel{
    if(!_codeLabel){
        
        _codeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.nameLabel.bottomEdge, ActualWidth(224), ActualHeight(34))];
        
        _codeLabel.textColor = Color(0x666666);
        _codeLabel.textAlignment = NSTextAlignmentCenter;
        _codeLabel.font = ContentFont;
        
        [self addSubview:_codeLabel];
        
        
        
    }
    return _codeLabel;
}

- (UILabel *)attribiteLabel{
    if(!_attribiteLabel){
        
        _attribiteLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.nameLabel.rightEdge, 0, ActualWidth(130), ActualHeight(88))];
        
        _attribiteLabel.textColor = ContentTextColor_Black;
        _attribiteLabel.textAlignment = NSTextAlignmentCenter;
        _attribiteLabel.font = NaviFont;
        
        [self addSubview:_attribiteLabel];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.nameLabel.rightEdge, 0, 1, ActualHeight(88))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    
    return _attribiteLabel;
    
}

- (UILabel *)storePostionLabel{
    if(!_storePostionLabel){
        
        _storePostionLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.attribiteLabel.rightEdge, 0, ActualWidth(235), ActualHeight(88))];
        
        _storePostionLabel.textColor = ContentTextColor_Black;
        _storePostionLabel.textAlignment = NSTextAlignmentCenter;
        _storePostionLabel.font = NaviFont;
        
        [self addSubview:_storePostionLabel];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.attribiteLabel.rightEdge, 0, 1, ActualHeight(88))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    
    return _storePostionLabel;
    
}

- (UILabel *)stockQuantityLabel{
    if(!_stockQuantityLabel){
        
        _stockQuantityLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.storePostionLabel.rightEdge,0, ActualWidth(135), ActualHeight(88))];
        
        _stockQuantityLabel.textColor = ContentTextColor_Black;
        _stockQuantityLabel.textAlignment = NSTextAlignmentCenter;
        _stockQuantityLabel.font = NaviFont;
        
        [self addSubview:_stockQuantityLabel];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.storePostionLabel.rightEdge, 0, 1, ActualHeight(88))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    
    return _stockQuantityLabel;
    
}

- (UILabel *)realQuantityLabel{
    if(!_realQuantityLabel){
        
        _realQuantityLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.stockQuantityLabel.rightEdge,0, ActualWidth(140), ActualHeight(88))];
        
        _realQuantityLabel.textColor = ContentTextColor_Black;
        _realQuantityLabel.textAlignment = NSTextAlignmentCenter;
        _realQuantityLabel.font = NaviFont;
        
        [self addSubview:_realQuantityLabel];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.stockQuantityLabel.rightEdge, 0, 1, ActualHeight(88))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    
    return _realQuantityLabel;
    
}

- (UILabel *)sellPriceLabel{
    if(!_sellPriceLabel){
        
        _sellPriceLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.realQuantityLabel.rightEdge,0, ActualWidth(160), ActualHeight(88))];
        
        _sellPriceLabel.textColor = ContentTextColor_Black;
        _sellPriceLabel.textAlignment = NSTextAlignmentCenter;
        _sellPriceLabel.font = NaviFont;
        
        [self addSubview:_sellPriceLabel];
        
        //分割线
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.realQuantityLabel.rightEdge, 0, 1, ActualHeight(88))];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        
        
    }
    
    return _sellPriceLabel;
    
}


- (void)setModel:(ICMRepairPartsModel *)model {
    _model = model;
    self.nameLabel.text = model.PART_NAME;
    self.codeLabel.text = model.PART_NO;
    self.attribiteLabel.text = [ICrEAMTool getCodeModelForCode:model.PART_SORT].desc;
    self.storePostionLabel.text = model.STORAGE_POSITION_CODE;
    self.stockQuantityLabel.text = model.STOCK_QUANTITY;
    self.realQuantityLabel.text = model.REAL_QUANTITY;
    self.sellPriceLabel.text = [NSString stringWithFormat:@"%.2f",[model.SALES_PRICE doubleValue]];
}


@end
